<template>
  <el-dialog title="就诊记录" v-model="visible"
             :close-on-click-modal="false" draggable width="70%">


    <el-row class="ml10">
      <el-form :inline="true" :model="state.queryForm" ref="queryRef">
<!--        <el-form-item label="就诊医生" prop="type">-->
<!--          <el-radio-group v-model="state.queryForm.type">-->
<!--            <el-radio-button value="0" label="0">家庭医生</el-radio-button>-->
<!--            <el-radio-button value="1" label="1">其他</el-radio-button>-->
<!--          </el-radio-group>-->
<!--        </el-form-item>-->

<!--        <el-form-item>-->
<!--          <el-button @click="getDataList" formDialogRef icon="search" type="primary">-->
<!--            {{ $t('common.queryBtn') }}-->
<!--          </el-button>-->
<!--          <el-button @click="resetQuery" formDialogRef icon="Refresh">{{-->
<!--              $t('common.resetBtn')-->
<!--            }}-->
<!--          </el-button>-->
<!--        </el-form-item>-->

      </el-form>
    </el-row>


    <el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
              :header-cell-style="tableStyle.headerCellStyle" highlight-current-row
              @sort-change="sortChangeHandle">
      <el-table-column type="index" label="#" width="60"/>
      <el-table-column prop="doctorCode" label="医生工号" width="100" show-overflow-tooltip/>
      <el-table-column prop="doctorName" label="医生姓名" width="100" show-overflow-tooltip/>
      <el-table-column prop="visitDept" label="就诊科室" width="130" show-overflow-tooltip/>
      <el-table-column prop="customerName" label="患者姓名" width="130" show-overflow-tooltip/>
      <el-table-column prop="icCard" label="身份证号" show-overflow-tooltip/>
      <el-table-column prop="medicalCard" label="社保卡号" show-overflow-tooltip/>
      <el-table-column prop="visitTime" label="就诊时间" show-overflow-tooltip/>
      <el-table-column prop="visitEndTime" label="结束时间" show-overflow-tooltip/>
    </el-table>
    <pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle"
                v-bind="state.pagination"/>
  </el-dialog>

</template>
<script setup lang="ts" name="bloodTicket">
import {BasicTableProps, useTable} from "/@/hooks/table";
// import {fetchList} from "/@/api/blood/bloodxCustomerDrug";
import {fetchList} from "/@/api/blood/bloodxCistomerDirection";
const queryRef = ref();
const visible = ref(false)
const state: BasicTableProps = reactive<BasicTableProps>({
  queryForm: {},
  pageList: fetchList,
  createdIsNeed: false,
  descs: ['visit_time'],
})

const {
  getDataList,
  currentChangeHandle,
  sizeChangeHandle,
  sortChangeHandle,
  tableStyle
} = useTable(state);

const openDialog = (val: any) => {
  visible.value = true
  if (val.medicalCard) {
    state.queryForm.medicalCard = val.medicalCard
  }
  if (val.icCard) {
    state.queryForm.icCard = val.icCard
  }
  if (state.queryForm.medicalCard || state.queryForm.icCard) {
    getDataList()
  }
};


// 清空搜索条件
// const resetQuery = () => {
//   // 清空搜索条件
//   queryRef.value?.resetFields();
//   // 清空多选
//   selectObjs.value = [];
//   getDataList();
// };

// 暴露变量
defineExpose({
  openDialog
});

</script>

<style scoped lang="scss">

</style>
